package Interview;

import java.text.DecimalFormat;
import java.util.Scanner;

/**
 * Created by loso on 2017/3/18.
 */
public class _360_2017318Test {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while(input.hasNext()) {

            double L = input.nextInt();
            double R = input.nextInt();
            //逆时针
            double X = R*(Math.cos((L%(2*Math.PI*R))/R));
            double Y = R*(Math.sin((L%(2*Math.PI*R))/R));
            //顺时针
            double Y2 = -Y;

            System.out.print( new DecimalFormat("0.000").format(X)+" ");
            System.out.println( new DecimalFormat("0.000").format(Y2));

            System.out.print( new DecimalFormat("0.000").format(X)+" ");
            System.out.println( new DecimalFormat("0.000").format(Y));
        }
        }
    }

